<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>麦包郎</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" href="css/login.css">
	
  <script type="text/javascript" src="js/jquery.min.js"></script>
 
  </head>
  
  <body>
    <div id="login">
    <!--<h1>Login</h1>-->
     <p style="color: red;">${msg}</p>
    <form method="post" action="emp/registered"  >
        <input type="text" required="required" placeholder="电话" id="phone" name="account" onblur="return yan()"><span id="ti"></span>
        <input type="text" required="required" placeholder="店名" name="name">

        <input type="password" required="required" placeholder="密码" name="pwd" id="pwd">

        <input type="password" required="required" placeholder="确认密码" name="rp" id="rp">

        <input class="but" id="zhuce" type="submit" onclick="return check()" value="立即注册" />
    </form>
</div>
 <script type="text/javascript">
  	function check(){
  		var phone=$("#phone").val();
  		var pwd=$("#pwd").val();
  		var tp=$("#rp").val();
  		
  		if( phone.length!=11){
  			alert("请填写正确手机号");
            return false;
         }
         //alert($("#ti").val());
         if($("#ti").val()!=""&&$("#ti").val()!=null){
         	alert("手机号已注册");
         	 window.location.href="register.jsp";
         	
         	 return false;
         }
         
         if(pwd!=tp){
			alert("两次密码不正确！");
			return false;
		 }
        // $("#zhuce").attr("disabled", "disabled");
		 return true;
  	}
  	
  	function yan(){
  	var phone=$("#phone").val();
  		 $.ajax({
             type: "GET",
             url: "emp/phonePan",
             data: {account:phone},
             dataType: "text",
             success: function(data){
             				if(data!="1"){
						        $("#ti").val(data);

						        console.log(data);
             				}
                    	}
         });
  	}
  </script>
  </body>
</html>
